class Person {
  //成员属性
  name;
  age;

  constructor(name, age) {
    this.name = name;
    this.age = age;
  }

  //成员方法
  say() {
    return `我是${this.name}，我今年${this.age}岁`;
  }
}

// let p1 = new Person("张三", 21);
// console.log(p1);
// let p2 = new Person("李四", 22);

//子类继承父类
class Student extends Person {
  study() {
    return `我是${this.name}，我喜欢学习`;
  }

  say() {
    return `我是${this.name}，我喜欢编程`
  }
}

let s1 = new Student("王思聪", 34);
// console.log(s1.say());
// console.log(s1.study());
console.log(s1.say())
